package com.zzyl.nursing.mapper;

import java.time.LocalDateTime;
import java.util.List;
import com.zzyl.nursing.domain.AlertData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 报警数据Mapper接口
 * 
 * @author ruoyi
 * @date 2025-05-05
 */
@Mapper
public interface AlertDataMapper extends BaseMapper<AlertData>
{
    /**
     * 查询报警数据
     * 
     * @param id 报警数据主键
     * @return 报警数据
     */
    public AlertData selectAlertDataById(Long id);

    /**
     * 查询报警数据列表
     * 
     * @param alertData 报警数据
     * @return 报警数据集合
     */
    public List<AlertData> selectAlertDataList(AlertData alertData);

    /**
     * 新增报警数据
     * 
     * @param alertData 报警数据
     * @return 结果
     */
    public int insertAlertData(AlertData alertData);

    /**
     * 修改报警数据
     * 
     * @param alertData 报警数据
     * @return 结果
     */
    public int updateAlertData(AlertData alertData);

    /**
     * 删除报警数据
     * 
     * @param id 报警数据主键
     * @return 结果
     */
    public int deleteAlertDataById(Long id);

    /**
     * 批量删除报警数据
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAlertDataByIds(Long[] ids);


//    DevicePropertyVo selectDevicePropertyStatus(String deviceName, String productKey);
    @Select("select * from alert_data where user_id = #{userId} and iot_id = #{iotId} and function_id = #{functionId} and create_time = #{creatTime}")
    AlertData selectAlertDataByUserId(@Param("userId")Long userId,  @Param("iotId")String iotId, @Param("functionId")String functionId, @Param("creatTime") LocalDateTime creatTime);
    @Select("select create_time from alert_data where id = #{id}")
    LocalDateTime selectCreatTimeByid(Long id);
}
